package gang.org.springframework.framework.factory;

import gang.org.springframework.framework.support.GangResolvableType;

/**
 * @author gang.chen
 * 访问spring bean 容器的根接口
 * @Date 2021/6/14 13:54
 */
public interface GangBeanFactory {

    /**
     * Determine the type of the bean with the given name. More specifically,
     * @param name Bean name
     * @param requiredType Class
     * @return the type of the bean
     * */
    <T> T getBean(String name, Class<T> requiredType);

    /**
     * Return Class by Class name
     * @param name class name
     * @return Class
     * */
    Class<?> getType(String name);

    /**
     * Determine the type of the bean with the given name. More specifically, determine the type of object that getBean would return for the given name.
     * @param name the name of the bean to query
     * @param allowFactoryBeanInit whether a {@code FactoryBean} may get initialized
     *  @return the type of the bean, or {@code null} if not determinable
     * */
    Class<?> getType(String name, boolean allowFactoryBeanInit);

    /**
     * 获取一个Object
     * @param name bean的名称
     * @return  返回一个Object
     * */
    Object getBean(String name);

    boolean isTypeMatch(String name, Class<?> typeToMatch);

    boolean isTypeMatch(String name, GangResolvableType typeToMatch);

}
